<style type="text/css">
#account-chooser{
	 
}
#account-chooser .widget-navbar-menu li a {
  padding: 12px 0 10px 0;
}
.widget-idp {
	background-image:-moz-linear-gradient(center top , #FCFCFC, #ECECEC);
	border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD;
	border-style:solid;
	border-width:1px;
	display:inline-block;
	height:50px;
	margin:0 1em 0 0;
	width:147px;
}
.widget-idp-hv{
	background-image:-moz-linear-gradient(center top , #FCFCFC, #dCdCdC);
	border-color:#DDDDDD #BBBBBB #BBBBBB #DDDDDD;
	border-style:solid;
	border-width:1px;
	display:inline-block;
	height:50px;
	margin:0 1em 0 0;
	width:147px;

	
}
</style>
<script type="text/javascript">
<!--
$("#tab_logout, #tab_login").hide();
$("#header").find(".div4").css({"width":"408px"});
-->
</script>
<?php echo $code;  ?>
<script type="text/javascript">
$(function(){
	var $topNav = $("#header").find(".div3");
	
	if ($topNav.size() > 0){
		$topNav.before('<div id="account-chooser" style="float:right; margin-left:4px; position:relative; top:4px; z-index:999;"></div>');
		$topNav.css({"padding-top":"8px"});
	} else {
		var accountChooserHtml = [];
		accountChooserHtml.push('<div class="box">');
		accountChooserHtml.push('<div class="top"><img src="catalog/view/theme/default/image/bestsellers.png" alt="" /><?php echo $heading_title; ?></div>');
		accountChooserHtml.push('<div class="middle" style="text-align: center;">');
		accountChooserHtml.push('<div id="account-chooser"></div>');
		accountChooserHtml.push('</div><div class="bottom">&nbsp;</div></div>')
		$("#google_identity_toolkit").html(accountChooserHtml.join('')).show();
	}
	var options = {};
	<?php if ($logged) { ?>
		options['signedIn'] = true;
		options['email'] = '<?php echo $logged_email; ?>';
		options['displayName'] = '<?php echo $logged_display_name; ?>';
		options['legacy'] = <?php echo ($logged_legacy ? 'true' : 'false'); ?>;
	<?php }  ?>
	$('#account-chooser').accountChooser(options);

//	showMailLogin();	

});

function showMailLogin(){
	var route = "<?php echo $_GET['route']; ?>";
	var git_maillogin = [
		{"id":"gmail", "domain":"gmail.com", "icon":"http://www.google.com/uds/modules/identitytoolkit/image/gmail-ac.png","url":"http://www.gmail.com"},
		{"id":"yahoo", "domain":"yahoo.com", "icon":"http://www.google.com/uds/modules/identitytoolkit/image/yahoo-ac.png","url":"http://mail.yahoo.com"},
		{"id":"aol", "domain":"aol.com", "icon":"http://www.google.com/uds/modules/identitytoolkit/image/aol-ac.png","url":"http://mail.aol.com"},
		{"id":"hotmal", "domain":"hotmail.com", "icon":"http://www.google.com/uds/modules/identitytoolkit/image/hotmail-ac.png","url":"http://mail.hotmail.com"}
	];


	if (route == 'account/account' || route == 'account/git_account'){
		var accounts = window.google.identitytoolkit.easyrp.util.accountstorage.readAccounts();
		if (accounts){
			var mailLoginHtml = ["<div id='git_mail_login'><p><b>Mail Login</b></p>"];

			$(accounts).each(function(i, v){
				$(git_maillogin).each(function(ii, vv){
					if (v.email.indexOf(vv.domain) >-1){
						mailLoginHtml.push("<div class='widget-idp'><a href='"+vv.url+"' target='_blank'><img src='"+vv.icon+"' /></a></div>");
					}	
				});
				var email = v.email;
					
			});
			mailLoginHtml.push('</div>');
			var $content = $("#content").find(".middle");
			if ($content.size() >0){
				$content.append(mailLoginHtml.join(''));
				$content.find(".widget-idp").hover(function(){
					$(this).addClass("widget-idp-hv").removeClass("widget-idp");
				}, function(){
					$(this).addClass("widget-idp").removeClass("widget-idp-hv");

				});
			}
		}
		
	}

}

</script>
<div id="google_identity_toolkit" style='display:none'></div>
 

